<%@ page contentType="text/html; charset=utf-8" language="java" import="java.util.*" pageEncoding="utf-8" errorPage="" %>
<%@ page import="com.club325.voicemicroblog.domain.VoiceFile" %>
<%@ page import="com.club325.voicemicroblog.persist.*" %>
<%@ page import="java.util.UUID" %>
<%@ page import="java.text.*" %>
<%@ page session="false" %>

<%
	HttpSession se = request.getSession(false);
	String name = null;
	if (se == null) {
		response.sendRedirect("/Microblog/pages/timeout.html");
		return;
	}
	name = (String)se.getAttribute("username");
	if (name == null) {
		response.sendRedirect("/Microblog/pages/timeout.html");
		return;
	}
	
	UUID uuid = UUID.randomUUID();
	String voicefileid = uuid.toString();
	
	ArrayList<VoiceFile> voiceFileList = (ArrayList<VoiceFile>)request.getAttribute("voiceFileList");

	int i = 0;
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/main.dwt.jsp" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>我发布的语音微博</title>
<!-- InstanceEndEditable -->

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Keywords" content="Microblog,Vioce,blog" />
<meta http-equiv="Description" content="Voice Microblog" />
<!-- InstanceBeginEditable name="head" -->
<link href="/Microblog/styles/issue.css" rel="stylesheet" type="text/css" />
<script src="/Microblog/Scripts/swfobject_modified.js" type="text/javascript"></script>
<!-- InstanceEndEditable -->
<link href="/Microblog/styles/main.css" rel="stylesheet" type="text/css" />

<link href="/Microblog/styles/template.css" rel="stylesheet" type="text/css" />
<link href="/Microblog/styles/global.css" rel="stylesheet" type="text/css" />
</head>

<%
	HttpSession session = request.getSession(false);
	String username = null;
	String userrole = null;
	String targetuser = null;
	if (session != null) {
		username = (String)session.getAttribute("username");
		userrole = (String)session.getAttribute("userrole");
		targetuser = username;
	}
%>

<body>
<div class="top">
  <div id="top_main"> 
    <%
    	if (username != null)
    	{
    %>
      <ul>
      <li><a href="/Microblog/pages/user_frame.jsp"><%= username %></a></li>
      <li><a href="/Microblog/VoiceblogPlazaServlet">广场</a></li>
      <li><a href="#">通知</a></li>
      <li><a href="#">帐号设置</a></li>
      <li>|<a href="/Microblog/LogOutServlet">退出</a></li>
      </ul>
    <%
    	}
    %> 
  </div>
</div>
<div class="main">
  <div id="head">
  <img src="/Microblog/images/logo.png" width="180" height="53" alt="logo" />
  	<div id="head_nav">
	<ul>
    	<li><a href="/Microblog/VoiceblogHomeServlet">我的首页</a></li>
    	<%
		if (username != null)
    	{
		%>
        <li><a href="/Microblog/VoiceblogMineServlet?targetuser=<%= username%>">我的微博</a></li>
        <%
		} else {
		%>
		<li><a href="#">我的微博</a></li>
		<%
		}
		%>
        <li><a href="/Microblog/pages/user_frame.jsp">会员中心</a></li>
        <li><a href="/Microblog/pages/admin_frame.jsp">管理中心</a></li>
  	</ul>
    </div>
  </div>
</div>

<div class="body">
  <!-- InstanceBeginEditable name="EditRegion_left" -->
  <div id="left">
    <form name="blog_message" id="blog_message" form action="/Microblog/MakeVoiceblogServlet" method="post">
      <textarea name="title" id="title" value=""></textarea>
      <input name="voicefileid" type="hidden" value="<%= voicefileid %>" />
      <div id="record">
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="220" height="140" id="FlashID" title="record">
          <param name="movie" value="/Microblog/flash/record.swf?voicefileid=<%= voicefileid %>" />
          <param name="quality" value="high" />
          <param name="wmode" value="opaque" />
          <param name="swfversion" value="9.0.45.0" />
          <!-- 此 param 标签提示使用 Flash Player 6.0 r65 和更高版本的用户下载最新版本的 Flash Player。如果您不想让用户看到该提示，请将其删除。 -->
          <param name="expressinstall" value="/Microblog/Scripts/expressInstall.swf" />
          <!-- 下一个对象标签用于非 IE 浏览器。所以使用 IECC 将其从 IE 隐藏。 -->
          <!--[if !IE]>-->
          <object type="application/x-shockwave-flash" data="/Microblog/flash/record.swf?voicefileid=<%= voicefileid %>" width="220" height="140">
            <!--<![endif]-->
            <param name="quality" value="high" />
            <param name="wmode" value="opaque" />
            <param name="swfversion" value="9.0.45.0" />
            <param name="expressinstall" value="/Microblog/Scripts/expressInstall.swf" />
            <!-- 浏览器将以下替代内容显示给使用 Flash Player 6.0 和更低版本的用户。 -->
            <div>
              <h4>此页面上的内容需要较新版本的 Adobe Flash Player。</h4>
              <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="获取 Adobe Flash Player" width="112" height="33" /></a></p>
            </div>
            <!--[if !IE]>-->
          </object>
          <!--<![endif]-->
        </object>
      </div>
      <input type="submit" name="submit" id="submit" value="" />
    </form>
    <div id="main">
      <div id="top">
        <a href="#">刷新微博</a>
      </div>
      <%
    	if (voiceFileList == null || voiceFileList.isEmpty()) {
      %>
      <h6>没有语音微博...</h6>
      <%
    	} else {
    		for (VoiceFile blog : voiceFileList) {
    			i++;
    			String num = String.valueOf(i);
      %>
      <div class="main_mes">
        <div class="main_mes_head">
          <img src="/Microblog/images/head.gif" width="50" height="50" alt="head" />
        </div>
        <h1><a href="/Microblog/VoiceblogMineServlet?targetuser=<%= blog.getSpeaker() %>"><%= blog.getSpeaker() %></a>：<%= blog.getLabel() %></h1>
        <div id="play">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="150" height="35" id="FlashID<%= num %>" title="play">
            <param name="movie" value="/Microblog/flash/play.swf?voicefileid=<%= blog.getVoiceFileID() %>" />
            <param name="quality" value="high" />
            <param name="wmode" value="opaque" />
            <param name="swfversion" value="9.0.45.0" />
            <!-- 此 param 标签提示使用 Flash Player 6.0 r65 和更高版本的用户下载最新版本的 Flash Player。如果您不想让用户看到该提示，请将其删除。 -->
            <param name="expressinstall" value="/Microblog/Scripts/expressInstall.swf" />
            <!-- 下一个对象标签用于非 IE 浏览器。所以使用 IECC 将其从 IE 隐藏。 -->
            <!--[if !IE]>-->
            <object type="application/x-shockwave-flash" data="/Microblog/flash/play.swf?voicefileid=<%= blog.getVoiceFileID() %>" width="150" height="35">
              <!--<![endif]-->
              <param name="quality" value="high" />
              <param name="wmode" value="opaque" />
              <param name="swfversion" value="9.0.45.0" />
              <param name="expressinstall" value="/Microblog/Scripts/expressInstall.swf" />
              <!-- 浏览器将以下替代内容显示给使用 Flash Player 6.0 和更低版本的用户。 -->
              <div>
                <h4>此页面上的内容需要较新版本的 Adobe Flash Player。</h4>
                <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="获取 Adobe Flash Player" width="112" height="33" /></a></p>
              </div>
              <!--[if !IE]>-->
            </object>
            <!--<![endif]-->
          </object>
        </div>
        <% 		Date date = blog.getModifiedDate();
				if (date != null)
				{
					SimpleDateFormat df = new SimpleDateFormat("MM月dd日 HH:mm");
		%>
        <h2><%= df.format(date) %></h2>
        <%
        		}
        %>
		<!--<h3><a href="#">取消关注</a></h3>-->
        <div class="main_mes_bottom"></div>
      </div>
      <%
    		}
    	}
      %>
      <div id="main_bottom">
		<!--<h1><a href="#">上一页</a></h1>-->
		<!--<h1>第1页</h1>-->
		<!--<h1><a href="#">下一页</a></h1>-->
      </div>
    </div>
  </div>
  <script type="text/javascript">
  	swfobject.registerObject("FlashID");
  <%
  	int j = 1;
  	for (j = 1; j <= i; j++)
  	{
  %>
	swfobject.registerObject("FlashID<%= String.valueOf(j) %>");
  <%
  	}
  	
  	targetuser = request.getParameter("targetuser");
  	if (targetuser == null)
  	{
  		targetuser = username;
  	}
  %>
  </script>
  <!-- InstanceEndEditable -->
  <div id="right">
    <img src="/Microblog/images/head.gif" width="60" height="60" alt="head" />
    <% 
    	StaticControllerUtil util = new StaticControllerImplement();
    	int focNum = util.getCountofSpeakersonFocus(targetuser);
    	int fansNum = util.getCountofListenersonFocus(targetuser);
    	int blogNum = util.getCountofVoiceBlog(targetuser);
    %>
    <h1><a href="#"><%= targetuser %></a></h1>
    <div id="info">
    <dl>
        <dt><a href="#"><%= String.valueOf(focNum) %></a></dt>
        <dd><a href="#">关注</a></dd>
    </dl>
    <dl>
        <dt><a href="#"><%= String.valueOf(fansNum) %></a></dt>
        <dd><a href="#">粉丝</a></dd>
    </dl>
    <dl>
        <dt><a href="#"><%= String.valueOf(blogNum) %></a></dt>
        <dd><a href="#">微博</a></dd>
    </dl>
    </div>
  </div>
  <div id="bottom"></div>
</div>

<div class="bottom">
  <p>Copyright © 2010 - 2011 CLUB325.  All Rights Reserved<br/>
  CLUB325  版权所有</p>
</div>
</body>
<!-- InstanceEnd --></html>
